<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/2/1 0001
  Time: 下午 7:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>${sessionScope.title}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../admin/css/x-admin.css" media="all">
</head>

<body >
<style>
     .layui-textarea{
        display: inline-block;
        width: 300px;
    }
    .layui-input{
        width: 300px;
    }
     .layui-form-select dl, .layui-nav-child{
         min-width: inherit;
         width: 300px;
     }
     .layui-form-select dl{
         left: 108px;
     }
</style>
<div class="x-body">
    <form class="layui-form">

        <div class="layui-form-item">
            <label for="userCode" class="layui-form-label">
                <span class="x-red">*</span>域名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userCode" name="domain" required="" lay-verify="required"
                       autocomplete="off" class="layui-input"  value="${domain}">
            </div>

        </div>
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>类型
            </label>
            <select name="type" lay-verify="">
                <option value="">请选择</option>
                <option value="0">分享域名</option>
                <option value="1">授权域名</option>
            </select>
        </div>
        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>状态
            </label>
            <select name="state" lay-verify="">
                <option value="">请选择</option>
                <option value="0">可用</option>
                <option value="1">不可用</option>
            </select>
        </div>



        <%--<div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>角色
            </label>
            <div class="layui-input-inline">
                <select name="roleId" id="roleId" lay-verify="">
                    <c:forEach items="${roleList}" var="rl">
                        <option value="${rl.id}"    <c:if test="${fn:contains(onRole, rl.id)}">selected="selected"</c:if>  >${rl.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>--%>

        <div class="layui-form-item">
            </label>
            <button  class="layui-btn" lay-filter="save" lay-submit >
                保存
            </button>
        </div>
    </form>
</div>
<script src="/js/layui/layui.js" charset="utf-8">
</script>
<script src="../../admin/js/x-layui.js" charset="utf-8">
</script>
<script src="/admin/js/jquery.min.js" charset="utf-8"></script>
<script>
    layui.use('form', function() {
        var form = layui.form;


        //监听提交
        form.on('submit(save)', function(data) {
            $.ajax({
                url: '/domain/addData',
                type: 'POST', //GET
                async: true,    //或false,是否异步
                data: data.field,
                timeout: 5000,    //超时时间
                dataType: 'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                success:function(data){
                    if(data.code=='000'){
                        layer.msg('添加成功');
                        setTimeout(function(){
                            location.reload();
                        },1000);
                    }else {
                        layer.msg('添加失败，请选择类型或状态!');
                    }
                }
            });
            return false;
        });


    });


</script>

</body>

</html>
